/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.com.sml.SEFM.BUS;

import vn.com.sml.SEFM.DAO.FraudTransactionDAO;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.persistence.RollbackException;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.SystemException;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import vn.com.sml.SEFM.domain.Merchant;
import vn.com.sml.SEFM.domain.Ip;
import vn.com.sml.SEFM.domain.Banks;
import vn.com.sml.SEFM.domain.Fraudtransactions;

import vn.com.sml.SEFM.util.HibernateUtil;

/**
 *
 * @author Tunp
 */
public class FraudTransactionBUS {
    public static Integer saveTransaction(Fraudtransactions trans) throws SecurityException, RollbackException, HeuristicRollbackException, HeuristicMixedException, IllegalStateException, SystemException {
        return FraudTransactionDAO.saveFraudTransaction(trans);
    }
    
    public static List<Fraudtransactions> listFraudtransactions() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
        return FraudTransactionDAO.listFraudtransactions();
    }
    
    public static Fraudtransactions getTransactionById(int id)
    {
        return FraudTransactionDAO.getFraudTransactionById(id);
    }
    
    public static Boolean DeleteTransaction(int id)
    {
        return FraudTransactionDAO.DeleteFraudTransaction(id);
    }
    
    public static Boolean update(Fraudtransactions trans) {
        return FraudTransactionDAO.update(trans);
    }
    
    public static List<Fraudtransactions> listFraudtransactions(String search_col, String search_text) {
        return FraudTransactionDAO.listFraudtransactions(search_col, search_text);
    }
    
    public static List<Fraudtransactions> listFraudtransactions(String condition) {
        return FraudTransactionDAO.listFraudtransactions(condition);
    }
    
    public static Integer SumAmountInADay(Date date, String cardnumber) {
        return FraudTransactionDAO.SumAmountInADay(date, cardnumber);
    }
    
    public static Integer SumAmountInADay(String merchantCode, Date date, String cardnumber) {
        return FraudTransactionDAO.SumAmountInADay(merchantCode, date, cardnumber);
    }
    
    public static Integer AvgAmountInMonth(String merchantCode, int month, String cardnumber) {
        return FraudTransactionDAO.AvgAmountInMonth(merchantCode,month, cardnumber);
    }
}
